#pragma once
#include <vector>
#include "../lib3dw/ColladaModel.h"
#include "../lib3dw/Vector2.h"
#include "../lib3dw/SelectableObject.h"
#include "../lib3dw/Box.h"
#include "../lib3dw/ParticleSystem.h"
#include "Die.h"

using namespace lib3dw;

namespace Dicewars
{
	class Player; //HACK class Player needs to be forward declared - circular header

	class BoardTile : public DrawableObject, public SelectableObject
	{
		public:
			BoardTile(Vector2* tilePosition);
			~BoardTile();
			ColladaModel* GetModel() const;
			bool Intersect(PickRay* r, float t0, float t1);
			Die* PushDie(Die* newDie);
			Die* PopDie();
			void Draw();
			void PlaceDie(Die* newDie);
			void SetOwner(Player* newOwner, GLfloat* color);
			const Vector2* GetPosition() const;
			unsigned int GetDiceCount();
			Player* GetOwner() const;
			
		private:
			Player* owner;
			Vector2* position;
			ColladaModel* model;
			ParticleSystem* explosion;
			std::vector<Die*> dice;
			std::vector<Die*>::const_iterator i;
	};
}